﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace AccessWare
{
    public partial class Modification : System.Web.UI.Page
    {
        SPCalling objSPCalling = new SPCalling();

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                DataSet dsLRNO = new DataSet();
                dsLRNO = objSPCalling.ExecuteDataset(CommandType.StoredProcedure, "GetLRNO");


                ddlLRNO.DataSource = dsLRNO.Tables[0];
                ddlLRNO.DataTextField = "truck_sheet";
                ddlLRNO.DataValueField = "truck_sheet";
                ddlLRNO.DataBind();
                LBLSAVE.Visible = false;
            }
        }
        protected void ddlLRNO_OnSelectedIndexChanged(object sender, EventArgs e)
        {
            DataSet ds1 = new DataSet();
            object[] objParam = new object[1];
            objParam[0] = ddlLRNO.SelectedItem.Value;
            ds1=objSPCalling.ExecuteDataset(CommandType.StoredProcedure, "GetLRdetails",objParam);
            Label1.Text = ds1.Tables[0].Rows[0]["gr_wt"].ToString();
            Label2.Text = ds1.Tables[0].Rows[0]["tare_wt"].ToString();
            Label3.Text = ds1.Tables[0].Rows[0]["net_wt"].ToString();
        }

        protected void Submit_CLick(object sender, EventArgs e)
        {
            object[] objParam = new object[2];
            objParam[1] = txtNEw.Text;
            objParam[0] = ddlLRNO.SelectedItem.Value;
            LBLSAVE.Text = objSPCalling.ExecuteDataset(CommandType.StoredProcedure, "updateLRdetails", objParam).Tables[0].Rows[0]["TextReceived"].ToString();
            LBLSAVE.Visible = true;
        }
    }
}